import http from "../https"
const baseURL = "http://82.157.143.31:8080"
// const baseURL = "http://192.168.1.122:8080"

//-------------------------- 营销活动
// 初始化活动列表
const initActivity = (page) => http({
    url: `${baseURL}/marketingCampaign/selectAll`,
    method: 'get',
    params: { page }
})
//查询营销活动
const setActivity = (key, page = 1) => http({
    url: `${baseURL}/marketingCampaign/selectLikeTitleOrTarget`,
    method: 'get',
    params: { key, page }
})

//新增活动
const addActivity = (obj) => http({
    url: `${baseURL}/marketingCampaign/insert`,
    method: 'post',
    data: { ...obj }
})

//修改活动
const amendActivity = (obj) => http({
    url: `${baseURL}/marketingCampaign/update`,
    method: 'post',
    data: { ...obj }
})
//删除活动
const delActivity = (id) => http({
    url: `${baseURL}/marketingCampaign/delete`,
    method: 'post',
    data: { id }
})
//查询状态
const setActivityStatus = () => http({
    url: `${baseURL}/marketingCampaign/selectStatus`,
    method: 'get',
    params: {}

})

//查询类型
const setActivityType = () => http({
    url: `${baseURL}/marketingCampaign/selectTypes`,
    method: 'get',
    params: {}
})

//-------------------------- 群组接口
// 查询页码列表
const initGroup = (page) => http({
    url: `${baseURL}/group/selectAll`,
    method: 'get',
    params: { page }
})

// 搜索某项
const setGroup = (key, page = 1) => http({
    url: `${baseURL}/group/selectLikeTitle`,
    method: 'get',
    params: { key, page }
})
// 修改某项
const amendGroup = (obj) => http({
    url: `${baseURL}/group/update`,
    method: 'post',
    data: { ...obj }
})
// 新增某项
const addGroup = (obj) => http({
    url: `${baseURL}/group/insert`,
    method: 'post',
    data: { ...obj }
})
// 删除某项
const delGroup = (obj) => http({
    url: `${baseURL}/group/delete`,
    method: 'post',
    data: { ...obj }
})
//查询状态
const setGroupStatus = () => http({
    url: `${baseURL}/group/selectStatus`,
    method: 'get',
    params: {}

})

//查询类型
const setGroupType = () => http({
    url: `${baseURL}/group/selectTypes`,
    method: 'get',
    params: {}
})


//--------------------群组成员
// 查询页码列表
const initMember = (obj) => http({
    url: `${baseURL}/groupMembers/selectByGroupId`,
    method: 'get',
    params: { ...obj }
})


// 搜索群id
const searGroup = (groupId) => http({
    url: `${baseURL}/groupMembers/selectByGroupId`,
    method: 'get',
    data: { groupId }
})
// 修改某项
const amendMember = (obj) => http({
    url: `${baseURL}/groupMembers/update`,
    method: 'post',
    data: { ...obj }
})
// 新增某项
const addMember = (obj) => http({
    url: `${baseURL}/groupMembers/insert`,
    method: 'post',
    data: { ...obj }
})
// 删除某项
const delMember = (id) => http({
    url: `${baseURL}/groupMembers/delete`,
    method: 'post',
    data: { id }
})

// --------------------邮件模板

// 查询页码列表
const initEmail = (page) => http({
    url: `${baseURL}/emailTemplate/selectAll`,
    method: 'get',
    params: { page }
})

// 搜索某项
const setEmail = (key, page = 1) => http({
    url: `${baseURL}/emailTemplate/selectLikeTitleOrTheme`,
    method: 'get',
    params: { key, page }
})
// 修改某项
const amendEmail = (obj) => http({
    url: `${baseURL}/emailTemplate/update`,
    method: 'post',
    data: { ...obj }
})
// 新增某项
const addEmail = (obj) => http({
    url: `${baseURL}/emailTemplate/insert`,
    method: 'post',
    data: { ...obj }
})
// 删除某项
const delEmail = (id) => http({
    url: `${baseURL}/emailTemplate/delete`,
    method: 'post',
    data: { id }
})

// --------------------邮件营销

// 查询页码列表
const initEmailMark = (page) => http({
    url: `${baseURL}/emailMarketing/selectAll`,
    method: 'get',
    params: { page }
})

// 搜索某项
const setEmailMark = (key, page = 1) => http({
    url: `${baseURL}/emailMarketing/selectLikeEmailOrMemberName`,
    method: 'get',
    params: { key, page }
})
// 修改某项
const amendEmailMark = (obj) => http({
    url: `${baseURL}/emailMarketing/update`,
    method: 'post',
    data: { ...obj }
})
// 新增某项
const addEmailMark = (obj) => http({
    url: `${baseURL}/emailMarketing/insert`,
    method: 'post',
    data: { ...obj }
})
// 删除某项
const delEmailMark = (id) => http({
    url: `${baseURL}/emailMarketing/delete`,
    method: 'post',
    data: { id }
})

// --------------------短信模板

// 查询页码列表
const initnoteMode = (page) => http({
    url: `${baseURL}/messageTemplate/selectAll`,
    method: 'get',
    params: { page }
})

// 搜索某项
const setnoteMode = (key, page = 1) => http({
    url: `${baseURL}/messageTemplate/selectLikeTitle`,
    method: 'get',
    params: { key, page }
})
// 修改某项
const amendnoteMode = (obj) => http({
    url: `${baseURL}/messageTemplate/update`,
    method: 'post',
    data: { ...obj }
})
// 新增某项
const addnoteMode = (obj) => http({
    url: `${baseURL}/messageTemplate/insert`,
    method: 'post',
    data: { ...obj }
})
// 删除某项
const delnoteMode = (id) => http({
    url: `${baseURL}/messageTemplate/delete`,
    method: 'post',
    data: { id }
})
// --------------------短信营销

// 查询页码列表
const initnoteMarke = (page) => http({
    url: `${baseURL}/messageMarketing/selectAll`,
    method: 'get',
    params: { page }
})

// 搜索某项
const setnoteMarke = (key, page = 1) => http({
    url: `${baseURL}/messageMarketing/selectLikePhoneOrMemberName`,
    method: 'get',
    data: { key, page }
})
// 修改某项
const amendnoteMarke = (obj) => http({
    url: `${baseURL}/messageMarketing/update`,
    method: 'post',
    data: { ...obj }
})
// 新增某项
const addnoteMarke = (obj) => http({
    url: `${baseURL}/messageMarketing/insert`,
    method: 'post',
    data: { ...obj }
})
// 删除某项
const delnoteMarke = (id) => http({
    url: `${baseURL}/messageMarketing/delete`,
    method: 'post',
    data: { id }
})
export {
    initActivity,
    setActivity,
    addActivity,
    amendActivity,
    delActivity,
    setActivityStatus,
    setActivityType,
    initGroup,
    setGroup,
    amendGroup,
    addGroup,
    delGroup,
    setGroupStatus,
    setGroupType,
    initMember,
    searGroup,
    amendMember,
    addMember,
    delMember,
    initEmail,
    setEmail,
    amendEmail,
    addEmail,
    delEmail,
    initEmailMark,
    setEmailMark,
    amendEmailMark,
    addEmailMark,
    delEmailMark,
    initnoteMode,
    setnoteMode,
    amendnoteMode,
    addnoteMode,
    delnoteMode,
    initnoteMarke,
    setnoteMarke,
    amendnoteMarke,
    addnoteMarke,
    delnoteMarke,
}